package cn.xuyang520.tyim.sys.service;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.springframework.scheduling.quartz.QuartzJobBean;

@PersistJobDataAfterExecution // 表示当正常执行完 Job 后, JobDataMap 中的数据应该被改动,以被下一次调用时用。
@DisallowConcurrentExecution // 不允许当前任务并发执行
public class TyQuartzJob_1 extends QuartzJobBean {

	@Override
	protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
		String threadName = Thread.currentThread().getName();
		System.out.println(threadName + "Job_1开始工作,持续6s");
		try {
			Thread.sleep(6000);
		} catch (InterruptedException e) {
			System.out.println(threadName + "Job_1结束工作,持续6s");
		}
	}

}
